package com.mostka.server;

import java.io.IOException;

import com.mostka.ws.server.WebSocketServlet;



@SuppressWarnings("serial")
public class WsServlet extends WebSocketServlet{

	

	@Override
	public void onMessage(int token, String channel, String message) {
		System.out.println("channel "+channel+": message from "+token+":"+message);
	}

	@Override
	public void onJoin(int token, String channel) {
		System.out.println("channel "+channel+": joined "+token);
		try {
			send(token, "ahoj");
		} catch (IOException e) {
			e.printStackTrace();
		} catch (InvalidTokenException e) {
			e.printStackTrace();
		}
	}

	@Override
	public void onClose(int token, String channel) {
		System.out.println("channel "+channel+": closed "+token);
	}


}
